﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Profile;
using System.Data;

using EHTSaleManager.Code;
using EHTSaleManager.Code.BLL;
using EHTSaleManager.Code.Utility;
using EHTSaleManager.Code.Entity;

namespace EHTSaleManager.UIAdmin
{
    public partial class AdminFAQs : System.Web.UI.Page
    {
        private Int32 Type = -1;
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Type = Int32.Parse(Request.QueryString["TypeFAQs"].ToString());
            }
            catch (Exception ex)
            {
                Type = -1;

            }
           
            if (!Page.IsPostBack)
            {
               
                LoadData();
            }

        }

        public void LoadData()
        {
            rpFQAs.DataSource = FAQsProvider.GetFAQs();
            rpFQAs.DataBind();
        }

        protected void ddlFAQs_SelectedIndexChanged(object sender, EventArgs e)
        {
            int type = Int32.Parse(ddlFAQs.SelectedValue.ToString());
            if (type != -1)
            {
                rpFQAs.DataSource = FAQsProvider.GetFAQsByType(type, true);
                rpFQAs.DataBind();
            }
            else
            {
                rpFQAs.DataSource = FAQsProvider.GetFAQs();
                rpFQAs.DataBind();
            }
        }

        protected void btnAddFAQs_Click(object sender, EventArgs e)
        {
            Response.Redirect("AdminFAQ.aspx");
        }
    }
}